package com.shenmazong;

import com.baomidou.mybatisplus.core.injector.ISqlInjector;
import org.redisson.Redisson;
import org.redisson.config.Config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableScheduling;

import java.util.ArrayList;

@SpringBootApplication
@EnableScheduling
@EnableDiscoveryClient
public class ServerEduJobApplication {

    public static void main(String[] args) {
        SpringApplication.run(ServerEduJobApplication.class, args);
    }
//    @Value("${redissonAddress}")
//    private String redisAddress;
    @Bean
    public Redisson redisson(){
        Config config = new Config();
//        String[] split = redisAddress.split(",");
//        ArrayList<String> list = new ArrayList<>();
//        for (String s : split) {
//            list.add("redis://"+s);
//        }
//        config.useClusterServers().setScanInterval(2000).setNodeAddresses(list);
        config.useSingleServer().setDatabase(0).setAddress("redis://172.27.0.100:6379");
        return (Redisson) Redisson.create(config);
    }
}
